<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<import om.example.database.bean.model></import>
<html>
<head>
    <style type="text/css">
        body {
            background: url(背景9.jpg) no-repeat center center fixed;
            background-size: cover;

            font: 150%/1.6 Baskerville, Palatino, serif;
        }

        .description {
            position: relative;
            margin: 0 auto;
            box-shadow: 0 0 0 1px hsla(0, 0%, 100%, .3) inset,
            0 .5em 1em rgba(0, 0, 0, 0.6);

        }

        .description::before {
            content: '';
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            margin: -30px;
            z-index: -1;
            -webkit-filter: blur(20px);
            filter: blur(20px);
        }
    </style>


</head>
<body onload="composition()">
<div>
    起始时间
    <select id="year">
        <option value="2000" class="active">2000</option>
        <option value="2001">2001</option>
        <option value="2002">2002</option>
    </select>
    <span>年</span>
    <select id="month">
        <option value="1" class="active">01</option>
        <option value="2">02</option>
    </select>
    <span>月</span>
    <select id="day" >
        <option value="1" class="active">01</option>
        <option value="2">02</option>
    </select>
    <span>日</span>
    <br>
    结束时间
    <select id="year1">
        <option value="2000" class="active">2000</option>
        <option value="2001">2001</option>
        <option value="2002">2002</option>
    </select>
    <span>年</span>
    <select id="month1">
        <option value="1" class="active">01</option>
        <option value="2">02</option>
    </select>
    <span>月</span>
    <select id="day1">
        <option value="1" >01</option>
        <option value="2">02</option>
    </select>
    <span>日</span>
</div>
<input type="button" value="确定" onclick="test()"/>
<script>
    function test(){
        theYear=getSelect(y);
        theMonth=getSelect(m);
        var sIndex2=m.selectedIndex;
        theDay=getSelect(d);
        var sIndex=d.selectedIndex;
        theYear1=getSelect(y1);
        theMonth1=getSelect(m1);
        var sIndex3=m1.selectedIndex;
        theDay1=getSelect(d1);
        var sIndex1=d1.selectedIndex;
        window.alert(theYear+d1.options[sIndex2].text+d.options[sIndex].text+" "+theYear1+d1.options[sIndex3].text+d1.options[sIndex1].text);
    }
</script>

<from method="post" id="my">
    <p class="description">
    <table id="tj" border="1" width="100%" style="text-align:center">
        <tr>
            <td width="70" height="25">rid</td>
            <td width="70" height="25">orderNo</td>
            <td width="70" height="25">id</td>
            <td width="70" height="25">名称</td>
            <td width="70" height="25">数量</td>
            <td width="70" height="25">价格</td>
            <td width="70" height="25">供应商</td>
            <td width="70" height="25">accountld</td>
            <td width="70" height="25">时间</td>
        </tr>
    <c:forEach items="${jinhuoList}" var="list">
        <tr>
            <td width="70" height="25">${list.rid}</td>
            <td width="70" height="25">${list.orderNo}</td>
            <td width="70" height="25">${list.id}</td>
            <td width="70" height="25">${list.name}</td>
            <td width="70" height="25">${list.number}</td>
            <td width="70" height="25">${list.price}</td>
            <td width="70" height="25">${list.supplier}</td>
            <td width="70" height="25">${list.accountld}</td>
            <td width="70" height="25">${list.time}</td>
        </tr>
    </c:forEach>
    </table>
    </p>
</from>
</body>

<script>
    var divv=document.querySelector('div');
    var y=document.getElementById('year');
    var m=document.getElementById('month');
    var d=document.getElementById('day');
    var y1=document.getElementById('year1');
    var m1=document.getElementById('month1');
    var d1=document.getElementById('day1');
    var theYear=0;
    var theMonth=0;
    var theDay=0;

    function getWeek(day){
        var weekday=new Array(7)
        weekday[0]="星期日";
        weekday[1]="星期一";
        weekday[2]="星期二";
        weekday[3]="星期三";
        weekday[4]="星期四";
        weekday[5]="星期五";
        weekday[6]="星期六";
        return weekday[day];
    }
    // 获取月份
    function getMonth(month){
        var Month=new Array(12);
        Month[0]=31;
        Month[1]=28;
        Month[2]=31;
        Month[3]=30;
        Month[4]=31;
        Month[5]=30;
        Month[6]=31;
        Month[7]=31;
        Month[8]=30;
        Month[9]=31;
        Month[10]=30;
        Month[11]=31;
        return Month[month-1];
    }

    divv.onchange=function(){
        specialDay();
        //cunrrentTime();
    }

    function composition(){
        composeChild(2002,2033,y);
        composeChild(2,13,m);
        composeChild(2,32,d);
        composeChild(2002,2033,y1);
        composeChild(2,13,m1);
        composeChild(2,32,d1);
    }

    function composeChild(start,end,parent){
        for(var i=start+1;i<end;i++){
            var option=document.createElement('option');
            option.setAttribute('value',i);
            if(i<10){
                i="0"+i;
            }
            option.innerHTML=i;
            parent.appendChild(option);
        }
    }

    function getSelect(y){
        var options=y.getElementsByTagName('option');
        for(var j=0;j<options.length;j++){
            if(options[j].selected){
                return y.children[j].value;
            }
        }
    }


    function specialDay(){

        var tempYear=getSelect(y);
        var tempMonth=getSelect(m);
        if(tempMonth==2) {
            var val=d.options.length;
            if ((tempYear % 400 == 0 || tempYear % 4 == 0) && tempMonth == 2) {
                if(val==31) {
                    d.remove(30);
                    d.remove(29);
                }
                else if(val==30) {
                    d.remove(29);
                }
                else if(val==28){
                    var option = document.createElement("option");
                    option.text = "29";
                    option.value = "29";
                    d.options.add(option);
                }
            } else {
                if(val==31) {
                    d.remove(30);
                    d.remove(29);
                    d.remove(28);
                }
                else if(val==30) {
                    d.remove(29);
                    d.remove(28);
                }
                else if(val==29){
                    d.remove(28);
                }
            }
        }
        else if(tempMonth==4||tempMonth==6||tempMonth==9||tempMonth==11){
            var val=d.options.length;
            if(val==31) {
                d.remove(30);
            }
            else if(val==29) {
                var option = document.createElement("option");
                option.text = "30";
                option.value = "30";
                d.options.add(option);
            }
            else if(val==28){
                var option = document.createElement("option");
                option.text = "29";
                option.value = "29";
                d.options.add(option);
                var option1 = document.createElement("option");
                option1.text = "30";
                option1.value = "30";
                d.options.add(option1);
            }
        }
        else{
            var val=d.options.length;
            if(val==30) {
                var option = document.createElement("option");
                option.text = "31";
                option.value = "31";
                d.options.add(option);
            }
            else if(val==29) {
                var option = document.createElement("option");
                option.text = "30";
                option.value = "30";
                d.options.add(option);
                var option1 = document.createElement("option");
                option1.text = "31";
                option1.value = "31";
                d.options.add(option1);
            }
            else if(val==28){
                var option = document.createElement("option");
                option.text = "29";
                option.value = "29";
                d.options.add(option);
                var option1 = document.createElement("option");
                option1.text = "30";
                option1.value = "30";
                d.options.add(option1);
                var option2 = document.createElement("option");
                option2.text = "31";
                option2.value = "31";
                d.options.add(option2);
            }
        }


        var tempYear=getSelect(y1);
        var tempMonth=getSelect(m1);
        if(tempMonth==2) {
            var val=d1.options.length;
            if ((tempYear % 400 == 0 || tempYear % 4 == 0) && tempMonth == 2) {
                if(val==31) {
                    d1.remove(30);
                    d1.remove(29);
                }
                else if(val==30) {
                    d1.remove(29);
                }
                else if(val==28){
                    var option = document.createElement("option");
                    option.text = "29";
                    option.value = "29";
                    d1.options.add(option);
                }
            } else {
                if(val==31) {
                    d1.remove(30);
                    d1.remove(29);
                    d1.remove(28);
                }
                else if(val==30) {
                    d1.remove(29);
                    d1.remove(28);
                }
                else if(val==29){
                    d1.remove(28);
                }
            }
        }
        else if(tempMonth==4||tempMonth==6||tempMonth==9||tempMonth==11){
            var val=d1.options.length;
            if(val==31) {
                d1.remove(30);
            }
            else if(val==29) {
                var option = document.createElement("option");
                option.text = "30";
                option.value = "30";
                d1.options.add(option);
            }
            else if(val==28){
                var option = document.createElement("option");
                option.text = "29";
                option.value = "29";
                d1.options.add(option);
                var option1 = document.createElement("option");
                option1.text = "30";
                option1.value = "30";
                d1.options.add(option1);
            }
        }
        else{
            var val=d1.options.length;
            if(val==30) {
                var option = document.createElement("option");
                option.text = "31";
                option.value = "31";
                d1.options.add(option);
            }
            else if(val==29) {
                var option = document.createElement("option");
                option.text = "30";
                option.value = "30";
                d1.options.add(option);
                var option1 = document.createElement("option");
                option1.text = "31";
                option1.value = "31";
                d1.options.add(option1);
            }
            else if(val==28){
                var option = document.createElement("option");
                option.text = "29";
                option.value = "29";
                d1.options.add(option);
                var option1 = document.createElement("option");
                option1.text = "30";
                option1.value = "30";
                d1.options.add(option1);
                var option2 = document.createElement("option");
                option2.text = "31";
                option2.value = "31";
                d1.options.add(option2);
            }
        }

    }

</script>
</html>